package com.yanqu.road.server.cmd.activity.qixi;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.QixiProto;
import com.yanqu.road.server.GameServer;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.manger.activity.qixi.QixiMgr;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.GameProtocol;

@Cmd(code = GameProtocol.S_QIXI_GET_MOST_GIFT_TARGET_USER, desc = "七夕获得送目标花最多的玩家")
public class QixiGetGiftTargetMostUserCmd extends AbstractCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {

        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        QixiProto.QixiGetMostGiftTargetUserReqMsg reqMsg = QixiProto.QixiGetMostGiftTargetUserReqMsg.parseFrom(packet.getBytes());
        QixiMgr.getGiftTargetMostUserInfo(GameServer.getInstance().getServerId(), player.getUserId(), reqMsg.getTargetUserId());

    }

    @Override
    public void sendData(GamePlayer player) {
        if (ret > 0) {
            player.sendPacket(ClientProtocol.U_QIXI_GET_MOST_GIFT_TARGET_USER, QixiProto.QixiGetMostGiftTargetUserRespMsg.newBuilder().setRet(ret));
        }
    }
}
